﻿@model kmaraszkiewicz.Models.AuthorDescription

@{
    ViewBag.Title = "About me";
}

@if (Model != null)
{    
    <fieldset>
        <div class="display-field">

                 @Html.Raw(Model.Content)
        
            @if (Model.Jobs.Count > 0)
            {
                <a href="#" id="show-jobs-table" class="btn pull-right">View details »</a>
                <table class="table table-striped" id="jobs-table">
                      <thead>
                        <tr>
                          <th>Company Name</th>
                          <th>Postion Name</th>
                        </tr>
                      </thead>
                      <tbody>
                        @foreach (var job in Model.Jobs)
                        {
                            <tr>
                                <td>
                                    @if (!String.IsNullOrEmpty(job.ComapnyLinkUrl))
                                    {
                                        <a href="@Url.Content(job.ComapnyLinkUrl)">
                                            @job.CompanyName
                                        </a>
                                    }
                                    else
                                    {
                                        @job.CompanyName
                                    }
                                </td>
                                <td>@job.JobPosition</td>
                                <td>@job.DateFrom.ToString("yyyy-MM-dd") do @job.DateTo.ToString("yyyy-MM-dd")</td>
                            </tr>
                        }
                      </tbody>
                    </table>

            }
        </div>
    </fieldset>
}
<hr />

@section scripts {
    <script type="text/javascript">
        $("#jobs-table").hide();
        $("#show-jobs-table").click(function () {
            $("#jobs-table").toggle();
            return false;
        });
    </script>
}
